

#ifndef __CE_RENDERMESH_H__ 
#define __CE_RENDERMESH_H__

#include <cegfx/ceexport.h>
#include <cegfx/igeometry.h>

class CE_GFX_API ceRenderMesh : public iGeometry
{
	IQF_DECLARATION;
protected:
	LPDIRECT3DVERTEXBUFFER9					vertexBuffer;
	unsigned												numVertices;
	LPDIRECT3DINDEXBUFFER9					indexBuffer;
	unsigned												numTriangles;
	LPDIRECT3DVERTEXDECLARATION9		vertexDeclaration;
	unsigned stride;

	ceBoundingBox										boundingBox;
public:
	ceRenderMesh ();
	~ceRenderMesh ();


	void SetVertices (LPDIRECT3DVERTEXBUFFER9	vertexBuffer, unsigned numVertices);
	LPDIRECT3DVERTEXBUFFER9 GetVertexBuffer ();
	const LPDIRECT3DVERTEXBUFFER9 GetVertexBuffer () const;
	unsigned GetNumVertices () const;

	void SetVertexDeclaration (LPDIRECT3DVERTEXDECLARATION9 declaration, unsigned stride);
	LPDIRECT3DVERTEXDECLARATION9 GetVertexDeclaration ();
	const LPDIRECT3DVERTEXDECLARATION9 GetVertexDeclaration () const;
	unsigned GetStride () const;

	void SetIndices (LPDIRECT3DINDEXBUFFER9 indexBuffer, unsigned numTriangles);
	LPDIRECT3DINDEXBUFFER9 GetIndexBuffer();
	const LPDIRECT3DINDEXBUFFER9 GetIndexBuffer() const;
	unsigned GetNumberOfTriangles () const;


	virtual void Render (const ceRenderEnv& renderEnv);
	virtual void Update (const ceUpdateEnv& updateEnv);
	ceBoundingBox& GetBoundingBox ();
	const ceBoundingBox& GetBoundingBox () const;

};

#endif /* ! __CE_RENDERMESH_H__ */ 
